//
//  IconView.m
//  IconDesign
//
//  Created by Ankit Thakur on 17/04/10.
//  Copyright 2010. All rights reserved.
//

#import "IconView.h"
#import <QuartzCore/QuartzCore.h>
#import "ATImageDownloader.h"
@implementation IconView

@synthesize imageDownloader;

@synthesize spinner;

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
			// Initialization code
		
			// Set the layer's corner radius
		[[self layer] setCornerRadius:8.0f];
			// Turn on masking
		[[self layer] setMasksToBounds:YES];
			// Display a border around the button 
			// with a 1.0 pixel width
		[[self layer] setBorderWidth:1.0f];
		spinner = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease];
		spinner.frame = CGRectMake(30, 35, 15, 15);
		[spinner setHidesWhenStopped:YES];
		[spinner setTag:222];
		[spinner startAnimating];
		[self addSubview:spinner];
    }
    return self;
}



- (void) loadImage:(NSString*)string_;{
}	

-(void) callBack:(NSData*)data
{
	if (data) {
		[spinner stopAnimating];
		[self setNeedsDisplay];
		[self setBackgroundImage:[UIImage imageWithData:data] forState:UIControlStateNormal];
	}
}
- (void)drawRect:(CGRect)rect {
		// Drawing code
}


- (void)dealloc {
	[imageDownloader release];
    [super dealloc];
}


@end